package com.chencl.cipher.dao;

import com.chencl.cipher.config.log.OperationLog;
import com.chencl.cipher.dto.OperationLogDTO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @program: dynamic-datasource
 * @description:
 * @author: jiangshengli
 * @create: 2022-03-17 14:43
 */
@Repository
@Mapper
public interface OperationLogMapper {

    @Insert("insert into operation_log values(#{id},#{ip},#{method},#{args},#{appid},#{userId},#{userName},#{returnValue},#{createTime})")
    int insert(OperationLog operationLog);

    @Select("select id,ip,appid,method,args,create_time createTime,return_value returnValue from operation_log limit #{pageNum},#{pageSize}")
    List<OperationLogDTO> queryOperationLogPage(int pageNum, int pageSize);

    @Select("select count(1) from operation_log")
    int pageCount();
}
